import axios from '@/libs/api.request'
import { setToken } from '@/libs/util'

export const login = ({ userName, password }) => {
  const data = {
    name: userName,
    password
  }
  return axios.request({
    url: 'administer/login',
    data,
    method: 'post'
  })
}

export const getUserInfo = (token) => {
  return axios.request({
    url: 'administer/userInfo',
    data: {
      token
    },
    method: 'get'
  })
}

export const logout = (token) => {
  return new Promise((resolve, reject) => {
    setToken('')
    resolve()
    reject()
  })

}
